/********************************************************************************
** 没有采用.ui文件，直接复制过来建立的
**
** Created by: Qt User Interface Compiler version 5.15.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#pragma once
/*
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QWidget>
*/
#include <QButtonGroup>
#include <QToolBar>
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QWidget>

#include "MainWindow.h"

extern const int x_max, y_max, label_size;

// 写这个套娃类主要是为了重写按键响应函数，以免它跟蛇争夺键盘焦点
class MyQPushButton : public QPushButton {

  Q_OBJECT

public:
  MyQPushButton(const QString &name, QWidget *parent)
      : QPushButton(name, parent) {}

  // 默认的是按键间的切换，现在直接传给基类避免了按键信号的截断
  void keyPressEvent(QKeyEvent *event) { QWidget::keyPressEvent(event); }
};

QT_BEGIN_NAMESPACE

class Ui_Snake {
public:
  QAction *actionbegin;
  QAction *actionstop;
  QAction *actionsave;
  QAction *actionload;
  QAction *actionexit;
  QAction *actionresume_2;
  QAction *actionrestart;
  QMenuBar *menubar;
  QMenu *menu;
  QStatusBar *statusbar;
  QButtonGroup *buttons;

  void setupUi(QMainWindow *Snake) {
    if (Snake->objectName().isEmpty())
      Snake->setObjectName(QString::fromUtf8("Snake"));

    actionbegin = new QAction(Snake);
    actionbegin->setObjectName(QString::fromUtf8("actionbegin"));
    actionstop = new QAction(Snake);
    actionstop->setObjectName(QString::fromUtf8("actionstop"));
    actionsave = new QAction(Snake);
    actionsave->setObjectName(QString::fromUtf8("actionsave"));
    actionload = new QAction(Snake);
    actionload->setObjectName(QString::fromUtf8("actionload"));
    actionexit = new QAction(Snake);
    actionexit->setObjectName(QString::fromUtf8("actionexit"));
    actionresume_2 = new QAction(Snake);
    actionresume_2->setObjectName(QString::fromUtf8("actionresume_2"));
    actionrestart = new QAction(Snake);
    actionrestart->setObjectName(QString::fromUtf8("actionrestart"));

    menubar = new QMenuBar(Snake);
    menubar->setObjectName(QString::fromUtf8("menubar"));
    menubar->setGeometry(QRect(0, 0, 800, 23));
    menu = new QMenu(menubar);
    menu->setObjectName(QString::fromUtf8("menu"));
    Snake->setMenuBar(menubar);
    statusbar = new QStatusBar(Snake);
    statusbar->setObjectName(QString::fromUtf8("statusbar"));
    Snake->setStatusBar(statusbar);

    menubar->addAction(menu->menuAction());
    menu->addAction(actionbegin);
    menu->addAction(actionstop);
    menu->addAction(actionresume_2);
    menu->addSeparator();
    menu->addAction(actionsave);
    menu->addAction(actionload);
    menu->addSeparator();
    menu->addAction(actionexit);
    menu->addAction(actionrestart);

    buttons = new QButtonGroup(Snake);
    buttons->addButton(new MyQPushButton("开始", Snake), 0);
    buttons->addButton(new MyQPushButton("暂停", Snake), 1);
    buttons->addButton(new MyQPushButton("继续", Snake), 2);
    buttons->addButton(new MyQPushButton("存档", Snake), 3);
    buttons->addButton(new MyQPushButton("读档", Snake), 4);
    buttons->addButton(new MyQPushButton("退出", Snake), 5);
    buttons->addButton(new MyQPushButton("重开", Snake), 6);

    retranslateUi(Snake);

    QMetaObject::connectSlotsByName(Snake);
  } // setupUi

  void retranslateUi(QMainWindow *Snake) {
    Snake->setWindowTitle(QCoreApplication::translate(
        "Snake", "\350\264\252\345\220\203\350\233\207", nullptr));
    actionbegin->setText(QCoreApplication::translate(
        "Snake", "\345\274\200\345\247\213", nullptr));
    actionstop->setText(QCoreApplication::translate(
        "Snake", "\346\232\202\345\201\234", nullptr));
    actionsave->setText(QCoreApplication::translate(
        "Snake", "\345\255\230\346\241\243", nullptr));
    actionload->setText(QCoreApplication::translate(
        "Snake", "\350\257\273\346\241\243", nullptr));
    actionexit->setText(QCoreApplication::translate(
        "Snake", "\351\200\200\345\207\272", nullptr));
    actionresume_2->setText(QCoreApplication::translate(
        "Snake", "\347\273\247\347\273\255", nullptr));
    actionrestart->setText(
        QCoreApplication::translate("Snake", "重开", nullptr));
    menu->setTitle(QCoreApplication::translate(
        "Snake", "\350\217\234\345\215\225", nullptr));

    for (int i = 0; i < 7; i++) {
      buttons->buttons()[i]->setGeometry((x_max + 1) * label_size,
                                         (15 + i) * label_size + 10,
                                         4 * label_size, label_size);
      // buttons->buttons()[i]->show();
    }

    Snake->setWindowTitle(
        QCoreApplication::translate("Snake", "Snake", nullptr));
  } // retranslateUi
};

namespace Ui {
class SnakeWindow : public Ui_Snake {};
} // namespace Ui

QT_END_NAMESPACE
